package com.mission.schedule.CommonDialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.mission.schedule.R;
import com.mission.schedule.bean.CalenderNoteBean;
import com.mission.schedule.bean.qd606.NoteTitleDetailBean;
import com.mission.schedule.utils.SharedPrefUtil;

import java.util.List;

/**
 * 清单编辑子项对话框
 * Created by liwei on 2017/4/18.
 */

public class CalenderNoteEditChildMenuDialog extends Dialog {


    CallBack callBack;

    SharedPrefUtil sharedPrefUtil = null;
    Context context;
    WindowManager windowManager;


    public CalenderNoteEditChildMenuDialog(@NonNull final Context context, @StyleRes int themeResId,
                                           WindowManager windowManager) {
        super(context, themeResId);
        this.context = context;
        this.windowManager = windowManager;

        setCanceledOnTouchOutside(true);

        View view = LayoutInflater.from(context).inflate(R.layout.dialog_calender_note_edit_child_menu, null);
        setContentView(view);

        view.findViewById(R.id.copy_content).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.copycontent();
                dismiss();
            }
        });
        view.findViewById(R.id.copy).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.copy();
                dismiss();
            }
        });
        view.findViewById(R.id.settitle).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.settitle();
                dismiss();
            }
        });

        view.findViewById(R.id.add_daiban).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.adddaiban();
                dismiss();
            }
        });
        view.findViewById(R.id.add_calender).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.add_calender();
                dismiss();
            }
        });
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        window.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
        params.width = windowManager.getDefaultDisplay().getWidth() - 30;
        params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        window.setAttributes(params);
    }

    public interface CallBack {
        void copycontent();
        void copy();
        void settitle();
        void adddaiban();
        void add_calender();

    }

    public CallBack getCallBack() {
        return callBack;
    }

    public void setCallBack(CallBack callBack) {
        this.callBack = callBack;
    }
}
